from flask import Blueprint, session, redirect, url_for, g, request
from first_info.utils.comment import user_login_data

admin_blue = Blueprint('admin', __name__, url_prefix='/admin')

from . import views

@admin_blue.before_request
@user_login_data
def check_admin():
    user = g.user
    # if not user:
    #     return
    if user:
        is_admin = user.is_admin
    # is_admin = session.get('is_admin')
        if not is_admin:
            return redirect(url_for('index.index'))


